Framework EDI Reference. Methods and Properties
ediDataSegment. DataElementValue

Gets or sets the value of a data element in the data segment.

Syntax:

Parameters:

Remarks:

The values in data elements are the actual data in an EDI file.  This property provides the ability to access and modify values on any data elements in the data segment by virtue of the element's identifier, or position in the collection, and its repeating instance.

The vElement and vSubElement parameters are variants whereby the identifier or the position can be passed.  If an identifier is specified then it is passed as a string parameter; otherwise the position can be passed as a numeric parameter.  The lRepeatInstance parameter is always passed as numeric.

For example, consider a data segment having the following data elements and associated values:

Position  ID REQ Value
01 366 M AG
02 93 O CLARK KENT
02 93 O LOIS LANE
03 365 O
04 C034 O
Position  ID REQ Value
01 1574 M DSS
02 1575 M ZZZ
04 C034 O
Position  ID REQ Value
01 1574 M ISH
02 1575 M MD5
05 365 O
06 364 O
07 365 O
08 364 O
09 443 O

The above data segment has the following notable properties:

Getting/Setting a value from a simple element

Any of the following statements can be used to get the value "AG" from the simple element "366" at position 1.

  1. sValue = oDataSegment.DateElementValue(1)
  2. sValue = oDataSegment.DateElementValue("366")

The following changes the value at simple element "366" at position 1 to "AA".

  1. oDataSegment.DateElementValue(1) = "AA"
  2. oDataSegment.DateElementValue("366") = "AA"

Getting/Setting a value from a repeating simple element

The following statements can be used to get the value "CLARK KENT" from the simple element "93" at position 2.

  1. sValue = oDataSegment.DateElementValue(2, 0, 1)
  2. sValue = oDataSegment.DateElementValue("93", "", 1)

The following gets the value "LOIS LANE" from second repeating instance.

  1. sValue = oDataSegment.DateElementValue(2, 0, 2)
  2. sValue = oDataSegment.DateElementValue("93", "", 2)

The following changes the value "CLARK KENT" to "JOHN SMITH", or "LOIS LANE" to "SALLY SIXPACK".

' Changes the data element value to JOHN SMITH.

  1. oDataSegment.DateElementValue(2, 0, 1) = "JOHN SMITH"
  2. oDataSegment.DateElementValue("93", "", 1) = "JOHN SMITH"

' Changes the data element value to SALLY SIXPACK.
  1. oDataSegment.DateElementValue(2, 0, 2) = "SALLY SIXPACK"
  2. oDataSegment.DateElementValue("93", "", 2) = "SALLY SIXPACK"

Getting/Setting a value from a component element in a composite element

Any of the following statements can be used to get the value "ZZZ" from the component element "1575" at position 2 of the composite element C034.  The value is retrieved from the first repeating instance of the composite element.  Because it is the first repeating instance, the lRepeatInstance parameter does not have to be specified because the first instance is expected by default.

  1. sValue = oDataSegment.DateElementValue(4, 2)
  2. sValue = oDataSegment.DateElementValue("C034", "1575")
  3. sValue = oDataSegment.DateElementValue(4, "1575")
  4. sValue = oDataSegment.DateElementValue("C034", 2)

Any of the following statements changes the value of the component element "1575" at position 2 of the composite element C034 to "SHA".

  1. oDataSegment.DateElementValue(4, 2) = "SHA"
  2. oDataSegment.DateElementValue("C034", "1575") = "SHA"
  3. oDataSegment.DateElementValue(4, "1575") = "SHA"
  4. oDataSegment.DateElementValue("C034", 2) = "SHA"

Getting/Setting a value from a component element in a repeating composite element

The following statements can be used to get the value "MD5" from the component element "1575" at position 2 of the composite element C034.  The value is retrieved from the second repeating instance of the composite element.  In this case, the lRepeatInstance parameter must be set to 2 to specify the second repeating instance of the composite.

  1. sValue = oDataSegment.DateElementValue(4, 2, 2)
  2. sValue = oDataSegment.DateElementValue("C034", "1575", 2)
  3. sValue = oDataSegment.DateElementValue(4, "1575", 2)
  4. sValue = oDataSegment.DateElementValue("C034", 2, 2)

Any of the following statements changes the value of the component element "1575" at position 2 of the composite element C034 to "MDC".

  1. oDataSegment.DateElementValue(4, 2, 2) = "MDC"
  2. oDataSegment.DateElementValue("C034", "1575", 2) = "MDC"
  3. oDataSegment.DateElementValue(4, "1575", 2) = "MDC"
  4. oDataSegment.DateElementValue("C034", 2, 2)= "MDC"

Sample

P_DataElementValue.zip